﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Utilities;

namespace Model.Data
{
    public class DataHandler
    {
        public static RequestData Analysis(string json)
        {
            RequestData requestData = new RequestData();

            try
            {
                dynamic obj = JsonHelper.DeserializeJsonToObject<dynamic>(json);

                dynamic data = obj.data;
                string tag = data.tag;
                int printIndex = CommonHelper.GetInt(data, "printIndex");

                requestData.SetType(tag);
                requestData.data = data;
                requestData.printIndex = printIndex;
            }
            catch (Exception)
            {
            }

            return requestData;
        }
    }
}
